<div class="normal-page-content">
    <div class="panel panel-default">
        <!-- Betting Information -->
        <div class="panel-heading">
            <i class="fa fa-lg fa-bullseye"></i> Decentralized Betting Bounty
        </div>
        <div class="panel-body">
            <div class="panel panel-default pull-right" style="width: 250px;margin-left: 10px">
                <!-- Betting Information -->
                <div class="panel-heading">
                    <i class="fa fa-lg fa-bitcoin"></i> Bounty Information
                </div>
                <div class="panel-body text-center" style="background-color: #d9edf7">
                    <div id="bounty-amount">0 XCP</div>
                    <div id="bounty-funded">0.00% Funded (0 XCP)</div>
                    <div class="progress margin-bottom-5">
                        <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;" id="bounty-progressbar">
                        </div>
                    </div>            
                    <a href="#" class="btn btn-block btn-success margin-bottom-5" id="donate-now">Donate Now</a>
                </div>
            </div>
            <p>Counterparty has a robust <a href="https://docs.counterparty.io/docs/develop/api/#create_bet">decentralized betting system</a> built into the protocol with the following features :</p>
            <ul>
                <li>Allows anyone to operate an oracle and broadcast event information to the blockchain</li>
                <li>Oracle operators are able to earn a percentage (%) of any bets placed with them</li>
                <li>Bet funds are escrowed and paid out by the protocol (No risk of stolen funds)</li>
            </ul>
            <p>The FreeWallet team would like to add support for a <b><i>integrated betting interface</i></b> with the following features :</p>
            <ul>
                <li>Simple interface that allows anyone to setup and operate an oracle/feed</li>
                <li>'Oracle &amp; Feed Directories' to allow browsing of oracles, feeds, and events that can be bet upon</li>
                <li>Simple interface that allows anyone to place a bet on an oracle/feed</li>
                <li>Bet history interface which shows betting history, results, and allows exporting bet data</li>
            </ul>
            <p class="text-justify">These features will be made available to all wallet users at no cost after the development bounty is fully funded.</p>
            <p class="text-justify">Users who hold <a href="https://tokenscan.io/asset/FULLACCESS" target="_blank"><b>FULLACCESS</b></a> or <a href="https://tokenscan.io/asset/XCHAINPEPE" target="_blank"><b>XCHAINPEPE</b></a> tokens will have immediate access to all the features listed above after the betting interface is completed.</p>
            <p><b>Bounty Address</b> : <span id="bounty-address"></span></p>
        </div>
    </div>
</div>



<script>
$(document).ready(function(){

    // Define information about this bounty;
    var address = '1FWBetKxYBmMDszTAkyK1VYC6gLxznzjMG',
        bounty  = 3000,
        balance = 0,
        percent = 0;

    // Update bounty address and amount
    $('#bounty-address').html('<a href="' + FW.EXPLORER_API + '/address/' + address + '" target="_blank">' + address + '</a>')
    $('#bounty-amount').html(numeral(bounty).format('0,0') + ' XCP');

    // Lookup the current balance at the bounty address
    $.getJSON(FW.EXPLORER_API + '/api/balances/' + address, function(o){
        if(o.address==address){
            o.data.forEach(function(item){
                if(item.asset=='XCP'){
                    balance = numeral(item.quantity).format('0');
                    percent = (numeral(item.quantity).value() / bounty) * 100;
                }
            });
            $('#bounty-progressbar').attr('aria-valuenow',percent);
            $('#bounty-progressbar').css('width',percent + '%');
            $('#bounty-funded').text(numeral(percent).format('0.00') + '% Funded (' + balance + ' XCP)');
        }
    });

    // When a user clicks the donate now button, save bounty address and launch 'Send Funds' window
    $('#donate-now').click($.debounce(100, function(e){
        FW.DIALOG_DATA = {
            destination: address,
            token: 'XCP'
        };
        dialogSend();
    }));
});
</script>

